<?php

namespace app\controller\main;

use linkphp\Application;

class Download
{

    public function __construct()
    {
        Application::singletonEager(
            'download',
            'app\\logic\\main\Download'
        );
        Application::singletonEager(
            'downloadData',
            'app\\model\\main\Download'
        );
        Application::singletonEager(
            'auth',
            'app\\controller\\main\\Auth'
        );
    }

    public function push()
    {
        return Application::get('download')->push();
    }

    public function getDownList()
    {
        return Application::get('download')->getDownList();
    }

    public function orderVip()
    {
        if($user = Application::get('auth')->getUserInfo()){
            return Application::get('download')->orderVip($user);
        } else {
            return ['code' => 2, 'msg' => '未登入'];
        }
    }

    public function getItem()
    {
        return Application::get('download')->getItem();
    }

}